<?php

class DefaultController extends Controller
{
    public function actionConnector()
	{
        $this->layout=false;
        
        Yii::import('elfinder.vendors.*');
        require_once('elFinder.class.php');

        $opts=array(
           // 'root'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR,
		   'root'=>Yii::app()->basePath.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'media'.DIRECTORY_SEPARATOR.'anh122'.DIRECTORY_SEPARATOR,
            'URL'=>Yii::app()->baseUrl.'/../media/anh122/',
            'rootAlias'=>'Home',
        );
		
		if(!is_dir($opts['root'])){
        	mkdir($opts['root']);
			mkdir($opts['root'].'images'.DIRECTORY_SEPARATOR);
			mkdir($opts['root'].'stories'.DIRECTORY_SEPARATOR);
		}
		$f = "c://taisaovay.txt";
		$fp = fopen($f,'w');
		fwrite($fp,$opts['root']);
		fclose($fp);

        $fm=new elFinder($opts);
        $fm->run();
	}
}